﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CrossLayerCommunication;

namespace ExampleWebApplication.Messages
{
    public class AllMessages
    {
        public readonly IMessage CouldntAccessStorage = Message.Create(100, "CouldntAccessStorage");
        public IMessage UnknownMessage = Message.Create(900, "UnknownMessage");


        public UserMessages UsersMessages { get; protected set; }
        public TaskMessages TasksMessages { get; protected set; }

        
        public IMessage GetMessageById(int messageId)
        {
            IMessage message = null;
            if (Message.TryGetMessageById(messageId, out message))
                return message;

            //TODO Logging
            return UnknownMessage;
        }

        protected AllMessages()
        {
            UsersMessages = new UserMessages();
            TasksMessages = new TaskMessages();
        }

        static readonly AllMessages _Instance = new AllMessages();
        public static AllMessages Instance {
            get { return _Instance; }
        }
    }
}